package com.zsc.externalservice.controller;

import com.zsc.externalservice.entity.vo.OrderVO;
import com.zsc.externalservice.services.OrderService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

@RestController
@RequestMapping("/api/order")
//@Api(tags = "订单相关信息接口")
@Slf4j
public class OrderController {

    @Resource
    private OrderService orderService;

    /**
     * 获取用户的所有订单信息
     * @param custUuid 用户uuid
     * @return List
     */
    @GetMapping("/getOrderList")
//    @ApiOperation("获取用户的所有订单信息")
    @ApiImplicitParam(name = "custUuid", value = "客户编码", required = true, dataTypeClass = String.class)
    public List<OrderVO> getOrderList(String custUuid) {
        log.info("获取用户所有订单信息, customerCode:{}", custUuid);
        return orderService.getAllOrderList(custUuid);
    }

    /**
     * 根据用户uuid获取最近一次订单的卷烟数据
     * @param customUuid 用户uuid
     * @return 卷烟代码列表
     */
    @GetMapping("/getOrderListByCustUuid")
//    @ApiOperation("根据用户uuid获取最近一次订单的卷烟数据")
    public List<OrderVO> getOrderListByCustUuid(String customUuid) {
        log.info("根据用户uuid获取最近一次订单的卷烟数据, customUuid:{}", customUuid);
        return orderService.getOrderListByCustUuid(customUuid);
    }
}
